﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace IslandInterloper.Engine
{
    internal class AvatarCrewmember:GameClient
    {
        private string crewmember = string.Empty;
        private int count = 0;
        public int Count
        {
            get
            {
                return count;
            }
            set
            {
                count = value;
            }
        }
        internal AvatarCrewmember(Game theGame, string theCrewmember)
            : base(theGame)
        {
            crewmember = theCrewmember;
            count = Game.Crewmembers[theCrewmember].GenerateCrew();
        }
        internal AvatarCrewmember(Game theGame, XElement element)
            : base(theGame)
        {
            FromXElement(element);
        }
        public void FromXElement(XElement element)
        {
            crewmember = element.Name.LocalName;
            count = Utilities.XElementToInt(element);
        }
        public override XElement ToXElement(XName xName)
        {
            XElement result = new XElement(xName, count.ToString());
            return result;
        }

    }
}
